
/*
'===============================================================================
'  Generated From - CSharp_dOOdads_BusinessEntity.vbgen
' 
'  ** IMPORTANT  ** 
'  How to Generate your stored procedures:
' 
'  SQL        = SQL_StoredProcs.vbgen
'  ACCESS     = Access_StoredProcs.vbgen
'  ORACLE     = Oracle_StoredProcs.vbgen
'  FIREBIRD   = FirebirdStoredProcs.vbgen
'  POSTGRESQL = PostgreSQL_StoredProcs.vbgen
'
'  The supporting base class SqlClientEntity is in the Architecture directory in "dOOdads".
'  
'  This object is 'abstract' which means you need to inherit from it to be able
'  to instantiate it.  This is very easilly done. You can override properties and
'  methods in your derived class, this allows you to regenerate this class at any
'  time and not worry about overwriting custom code. 
'
'  NEVER EDIT THIS FILE.
'
'  public class YourObject :  _YourObject
'  {
'
'  }
'
'===============================================================================
*/

// Generated by MyGeneration Version # (1.3.0.3)

using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
using System.Collections.Specialized;

using MyGeneration.dOOdads;

namespace POSSystem.DAL
{
	public abstract class _InvoicePaymentHistories : SqlClientEntity
	{
		public _InvoicePaymentHistories()
		{
			this.QuerySource = "InvoicePaymentHistories";
			this.MappingName = "InvoicePaymentHistories";

		}	

		//=================================================================
		//  public Overrides void AddNew()
		//=================================================================
		//
		//=================================================================
		public override void AddNew()
		{
			base.AddNew();
			
		}
		
		
		public override void FlushData()
		{
			this._whereClause = null;
			this._aggregateClause = null;
			base.FlushData();
		}
		
		//=================================================================
		//  	public Function LoadAll() As Boolean
		//=================================================================
		//  Loads all of the records in the database, and sets the currentRow to the first row
		//=================================================================
		public bool LoadAll() 
		{
			ListDictionary parameters = null;
			
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_InvoicePaymentHistoriesLoadAll]", parameters);
		}
	
		//=================================================================
		// public Overridable Function LoadByPrimaryKey()  As Boolean
		//=================================================================
		//  Loads a single row of via the primary key
		//=================================================================
		public virtual bool LoadByPrimaryKey(int ID)
		{
			ListDictionary parameters = new ListDictionary();
			parameters.Add(Parameters.ID, ID);

		
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_InvoicePaymentHistoriesLoadByPrimaryKey]", parameters);
		}
		
		#region Parameters
		protected class Parameters
		{
			
			public static SqlParameter ID
			{
				get
				{
					return new SqlParameter("@ID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter InvoiceID
			{
				get
				{
					return new SqlParameter("@InvoiceID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter PaymentMethodID
			{
				get
				{
					return new SqlParameter("@PaymentMethodID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter PaidAmount
			{
				get
				{
					return new SqlParameter("@PaidAmount", SqlDbType.Decimal, 0);
				}
			}
			
			public static SqlParameter PaidDate
			{
				get
				{
					return new SqlParameter("@PaidDate", SqlDbType.DateTime, 0);
				}
			}
			
			public static SqlParameter SaleUser
			{
				get
				{
					return new SqlParameter("@SaleUser", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter Deleted
			{
				get
				{
					return new SqlParameter("@Deleted", SqlDbType.Bit, 0);
				}
			}
			
			public static SqlParameter LastModifiedDate
			{
				get
				{
					return new SqlParameter("@LastModifiedDate", SqlDbType.DateTime, 0);
				}
			}
			
			public static SqlParameter LastModifiedByUser
			{
				get
				{
					return new SqlParameter("@LastModifiedByUser", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter BranchID
			{
				get
				{
					return new SqlParameter("@BranchID", SqlDbType.Int, 0);
				}
			}
			
		}
		#endregion		
	
		#region ColumnNames
		public class ColumnNames
		{  
            public const string ID = "ID";
            public const string InvoiceID = "InvoiceID";
            public const string PaymentMethodID = "PaymentMethodID";
            public const string PaidAmount = "PaidAmount";
            public const string PaidDate = "PaidDate";
            public const string SaleUser = "SaleUser";
            public const string Deleted = "Deleted";
            public const string LastModifiedDate = "LastModifiedDate";
            public const string LastModifiedByUser = "LastModifiedByUser";
            public const string BranchID = "BranchID";

			static public string ToPropertyName(string columnName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[ID] = _InvoicePaymentHistories.PropertyNames.ID;
					ht[InvoiceID] = _InvoicePaymentHistories.PropertyNames.InvoiceID;
					ht[PaymentMethodID] = _InvoicePaymentHistories.PropertyNames.PaymentMethodID;
					ht[PaidAmount] = _InvoicePaymentHistories.PropertyNames.PaidAmount;
					ht[PaidDate] = _InvoicePaymentHistories.PropertyNames.PaidDate;
					ht[SaleUser] = _InvoicePaymentHistories.PropertyNames.SaleUser;
					ht[Deleted] = _InvoicePaymentHistories.PropertyNames.Deleted;
					ht[LastModifiedDate] = _InvoicePaymentHistories.PropertyNames.LastModifiedDate;
					ht[LastModifiedByUser] = _InvoicePaymentHistories.PropertyNames.LastModifiedByUser;
					ht[BranchID] = _InvoicePaymentHistories.PropertyNames.BranchID;

				}
				return (string)ht[columnName];
			}

			static private Hashtable ht = null;			 
		}
		#endregion
		
		#region PropertyNames
		public class PropertyNames
		{  
            public const string ID = "ID";
            public const string InvoiceID = "InvoiceID";
            public const string PaymentMethodID = "PaymentMethodID";
            public const string PaidAmount = "PaidAmount";
            public const string PaidDate = "PaidDate";
            public const string SaleUser = "SaleUser";
            public const string Deleted = "Deleted";
            public const string LastModifiedDate = "LastModifiedDate";
            public const string LastModifiedByUser = "LastModifiedByUser";
            public const string BranchID = "BranchID";

			static public string ToColumnName(string propertyName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[ID] = _InvoicePaymentHistories.ColumnNames.ID;
					ht[InvoiceID] = _InvoicePaymentHistories.ColumnNames.InvoiceID;
					ht[PaymentMethodID] = _InvoicePaymentHistories.ColumnNames.PaymentMethodID;
					ht[PaidAmount] = _InvoicePaymentHistories.ColumnNames.PaidAmount;
					ht[PaidDate] = _InvoicePaymentHistories.ColumnNames.PaidDate;
					ht[SaleUser] = _InvoicePaymentHistories.ColumnNames.SaleUser;
					ht[Deleted] = _InvoicePaymentHistories.ColumnNames.Deleted;
					ht[LastModifiedDate] = _InvoicePaymentHistories.ColumnNames.LastModifiedDate;
					ht[LastModifiedByUser] = _InvoicePaymentHistories.ColumnNames.LastModifiedByUser;
					ht[BranchID] = _InvoicePaymentHistories.ColumnNames.BranchID;

				}
				return (string)ht[propertyName];
			}

			static private Hashtable ht = null;			 
		}			 
		#endregion	

		#region StringPropertyNames
		public class StringPropertyNames
		{  
            public const string ID = "s_ID";
            public const string InvoiceID = "s_InvoiceID";
            public const string PaymentMethodID = "s_PaymentMethodID";
            public const string PaidAmount = "s_PaidAmount";
            public const string PaidDate = "s_PaidDate";
            public const string SaleUser = "s_SaleUser";
            public const string Deleted = "s_Deleted";
            public const string LastModifiedDate = "s_LastModifiedDate";
            public const string LastModifiedByUser = "s_LastModifiedByUser";
            public const string BranchID = "s_BranchID";

		}
		#endregion		
		
		#region Properties
	
		public virtual int ID
	    {
			get
	        {
				return base.Getint(ColumnNames.ID);
			}
			set
	        {
				base.Setint(ColumnNames.ID, value);
			}
		}

		public virtual int InvoiceID
	    {
			get
	        {
				return base.Getint(ColumnNames.InvoiceID);
			}
			set
	        {
				base.Setint(ColumnNames.InvoiceID, value);
			}
		}

		public virtual int PaymentMethodID
	    {
			get
	        {
				return base.Getint(ColumnNames.PaymentMethodID);
			}
			set
	        {
				base.Setint(ColumnNames.PaymentMethodID, value);
			}
		}

		public virtual decimal PaidAmount
	    {
			get
	        {
				return base.Getdecimal(ColumnNames.PaidAmount);
			}
			set
	        {
				base.Setdecimal(ColumnNames.PaidAmount, value);
			}
		}

		public virtual DateTime PaidDate
	    {
			get
	        {
				return base.GetDateTime(ColumnNames.PaidDate);
			}
			set
	        {
				base.SetDateTime(ColumnNames.PaidDate, value);
			}
		}

		public virtual int SaleUser
	    {
			get
	        {
				return base.Getint(ColumnNames.SaleUser);
			}
			set
	        {
				base.Setint(ColumnNames.SaleUser, value);
			}
		}

		public virtual bool Deleted
	    {
			get
	        {
				return base.Getbool(ColumnNames.Deleted);
			}
			set
	        {
				base.Setbool(ColumnNames.Deleted, value);
			}
		}

		public virtual DateTime LastModifiedDate
	    {
			get
	        {
				return base.GetDateTime(ColumnNames.LastModifiedDate);
			}
			set
	        {
				base.SetDateTime(ColumnNames.LastModifiedDate, value);
			}
		}

		public virtual int LastModifiedByUser
	    {
			get
	        {
				return base.Getint(ColumnNames.LastModifiedByUser);
			}
			set
	        {
				base.Setint(ColumnNames.LastModifiedByUser, value);
			}
		}

		public virtual int BranchID
	    {
			get
	        {
				return base.Getint(ColumnNames.BranchID);
			}
			set
	        {
				base.Setint(ColumnNames.BranchID, value);
			}
		}


		#endregion
		
		#region String Properties
	
		public virtual string s_ID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.ID) ? string.Empty : base.GetintAsString(ColumnNames.ID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.ID);
				else
					this.ID = base.SetintAsString(ColumnNames.ID, value);
			}
		}

		public virtual string s_InvoiceID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.InvoiceID) ? string.Empty : base.GetintAsString(ColumnNames.InvoiceID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.InvoiceID);
				else
					this.InvoiceID = base.SetintAsString(ColumnNames.InvoiceID, value);
			}
		}

		public virtual string s_PaymentMethodID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.PaymentMethodID) ? string.Empty : base.GetintAsString(ColumnNames.PaymentMethodID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.PaymentMethodID);
				else
					this.PaymentMethodID = base.SetintAsString(ColumnNames.PaymentMethodID, value);
			}
		}

		public virtual string s_PaidAmount
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.PaidAmount) ? string.Empty : base.GetdecimalAsString(ColumnNames.PaidAmount);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.PaidAmount);
				else
					this.PaidAmount = base.SetdecimalAsString(ColumnNames.PaidAmount, value);
			}
		}

		public virtual string s_PaidDate
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.PaidDate) ? string.Empty : base.GetDateTimeAsString(ColumnNames.PaidDate);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.PaidDate);
				else
					this.PaidDate = base.SetDateTimeAsString(ColumnNames.PaidDate, value);
			}
		}

		public virtual string s_SaleUser
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.SaleUser) ? string.Empty : base.GetintAsString(ColumnNames.SaleUser);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.SaleUser);
				else
					this.SaleUser = base.SetintAsString(ColumnNames.SaleUser, value);
			}
		}

		public virtual string s_Deleted
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Deleted) ? string.Empty : base.GetboolAsString(ColumnNames.Deleted);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Deleted);
				else
					this.Deleted = base.SetboolAsString(ColumnNames.Deleted, value);
			}
		}

		public virtual string s_LastModifiedDate
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.LastModifiedDate) ? string.Empty : base.GetDateTimeAsString(ColumnNames.LastModifiedDate);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.LastModifiedDate);
				else
					this.LastModifiedDate = base.SetDateTimeAsString(ColumnNames.LastModifiedDate, value);
			}
		}

		public virtual string s_LastModifiedByUser
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.LastModifiedByUser) ? string.Empty : base.GetintAsString(ColumnNames.LastModifiedByUser);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.LastModifiedByUser);
				else
					this.LastModifiedByUser = base.SetintAsString(ColumnNames.LastModifiedByUser, value);
			}
		}

		public virtual string s_BranchID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.BranchID) ? string.Empty : base.GetintAsString(ColumnNames.BranchID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.BranchID);
				else
					this.BranchID = base.SetintAsString(ColumnNames.BranchID, value);
			}
		}


		#endregion		
	
		#region Where Clause
		public class WhereClause
		{
			public WhereClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffWhereParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffWhereParameter(this);
					}

					return _tearOff;
				}
			}

			#region WhereParameter TearOff's
			public class TearOffWhereParameter
			{
				public TearOffWhereParameter(WhereClause clause)
				{
					this._clause = clause;
				}
				
				
				public WhereParameter ID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.ID, Parameters.ID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter InvoiceID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.InvoiceID, Parameters.InvoiceID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter PaymentMethodID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.PaymentMethodID, Parameters.PaymentMethodID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter PaidAmount
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.PaidAmount, Parameters.PaidAmount);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter PaidDate
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.PaidDate, Parameters.PaidDate);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter SaleUser
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.SaleUser, Parameters.SaleUser);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Deleted
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Deleted, Parameters.Deleted);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter LastModifiedDate
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.LastModifiedDate, Parameters.LastModifiedDate);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter LastModifiedByUser
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.LastModifiedByUser, Parameters.LastModifiedByUser);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter BranchID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.BranchID, Parameters.BranchID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}


				private WhereClause _clause;
			}
			#endregion
		
			public WhereParameter ID
		    {
				get
		        {
					if(_ID_W == null)
	        	    {
						_ID_W = TearOff.ID;
					}
					return _ID_W;
				}
			}

			public WhereParameter InvoiceID
		    {
				get
		        {
					if(_InvoiceID_W == null)
	        	    {
						_InvoiceID_W = TearOff.InvoiceID;
					}
					return _InvoiceID_W;
				}
			}

			public WhereParameter PaymentMethodID
		    {
				get
		        {
					if(_PaymentMethodID_W == null)
	        	    {
						_PaymentMethodID_W = TearOff.PaymentMethodID;
					}
					return _PaymentMethodID_W;
				}
			}

			public WhereParameter PaidAmount
		    {
				get
		        {
					if(_PaidAmount_W == null)
	        	    {
						_PaidAmount_W = TearOff.PaidAmount;
					}
					return _PaidAmount_W;
				}
			}

			public WhereParameter PaidDate
		    {
				get
		        {
					if(_PaidDate_W == null)
	        	    {
						_PaidDate_W = TearOff.PaidDate;
					}
					return _PaidDate_W;
				}
			}

			public WhereParameter SaleUser
		    {
				get
		        {
					if(_SaleUser_W == null)
	        	    {
						_SaleUser_W = TearOff.SaleUser;
					}
					return _SaleUser_W;
				}
			}

			public WhereParameter Deleted
		    {
				get
		        {
					if(_Deleted_W == null)
	        	    {
						_Deleted_W = TearOff.Deleted;
					}
					return _Deleted_W;
				}
			}

			public WhereParameter LastModifiedDate
		    {
				get
		        {
					if(_LastModifiedDate_W == null)
	        	    {
						_LastModifiedDate_W = TearOff.LastModifiedDate;
					}
					return _LastModifiedDate_W;
				}
			}

			public WhereParameter LastModifiedByUser
		    {
				get
		        {
					if(_LastModifiedByUser_W == null)
	        	    {
						_LastModifiedByUser_W = TearOff.LastModifiedByUser;
					}
					return _LastModifiedByUser_W;
				}
			}

			public WhereParameter BranchID
		    {
				get
		        {
					if(_BranchID_W == null)
	        	    {
						_BranchID_W = TearOff.BranchID;
					}
					return _BranchID_W;
				}
			}

			private WhereParameter _ID_W = null;
			private WhereParameter _InvoiceID_W = null;
			private WhereParameter _PaymentMethodID_W = null;
			private WhereParameter _PaidAmount_W = null;
			private WhereParameter _PaidDate_W = null;
			private WhereParameter _SaleUser_W = null;
			private WhereParameter _Deleted_W = null;
			private WhereParameter _LastModifiedDate_W = null;
			private WhereParameter _LastModifiedByUser_W = null;
			private WhereParameter _BranchID_W = null;

			public void WhereClauseReset()
			{
				_ID_W = null;
				_InvoiceID_W = null;
				_PaymentMethodID_W = null;
				_PaidAmount_W = null;
				_PaidDate_W = null;
				_SaleUser_W = null;
				_Deleted_W = null;
				_LastModifiedDate_W = null;
				_LastModifiedByUser_W = null;
				_BranchID_W = null;

				this._entity.Query.FlushWhereParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffWhereParameter _tearOff;
			
		}
	
		public WhereClause Where
		{
			get
			{
				if(_whereClause == null)
				{
					_whereClause = new WhereClause(this);
				}
		
				return _whereClause;
			}
		}
		
		private WhereClause _whereClause = null;	
		#endregion
	
		#region Aggregate Clause
		public class AggregateClause
		{
			public AggregateClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffAggregateParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffAggregateParameter(this);
					}

					return _tearOff;
				}
			}

			#region AggregateParameter TearOff's
			public class TearOffAggregateParameter
			{
				public TearOffAggregateParameter(AggregateClause clause)
				{
					this._clause = clause;
				}
				
				
				public AggregateParameter ID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.ID, Parameters.ID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter InvoiceID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.InvoiceID, Parameters.InvoiceID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter PaymentMethodID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.PaymentMethodID, Parameters.PaymentMethodID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter PaidAmount
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.PaidAmount, Parameters.PaidAmount);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter PaidDate
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.PaidDate, Parameters.PaidDate);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter SaleUser
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.SaleUser, Parameters.SaleUser);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Deleted
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Deleted, Parameters.Deleted);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter LastModifiedDate
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.LastModifiedDate, Parameters.LastModifiedDate);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter LastModifiedByUser
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.LastModifiedByUser, Parameters.LastModifiedByUser);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter BranchID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.BranchID, Parameters.BranchID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}


				private AggregateClause _clause;
			}
			#endregion
		
			public AggregateParameter ID
		    {
				get
		        {
					if(_ID_W == null)
	        	    {
						_ID_W = TearOff.ID;
					}
					return _ID_W;
				}
			}

			public AggregateParameter InvoiceID
		    {
				get
		        {
					if(_InvoiceID_W == null)
	        	    {
						_InvoiceID_W = TearOff.InvoiceID;
					}
					return _InvoiceID_W;
				}
			}

			public AggregateParameter PaymentMethodID
		    {
				get
		        {
					if(_PaymentMethodID_W == null)
	        	    {
						_PaymentMethodID_W = TearOff.PaymentMethodID;
					}
					return _PaymentMethodID_W;
				}
			}

			public AggregateParameter PaidAmount
		    {
				get
		        {
					if(_PaidAmount_W == null)
	        	    {
						_PaidAmount_W = TearOff.PaidAmount;
					}
					return _PaidAmount_W;
				}
			}

			public AggregateParameter PaidDate
		    {
				get
		        {
					if(_PaidDate_W == null)
	        	    {
						_PaidDate_W = TearOff.PaidDate;
					}
					return _PaidDate_W;
				}
			}

			public AggregateParameter SaleUser
		    {
				get
		        {
					if(_SaleUser_W == null)
	        	    {
						_SaleUser_W = TearOff.SaleUser;
					}
					return _SaleUser_W;
				}
			}

			public AggregateParameter Deleted
		    {
				get
		        {
					if(_Deleted_W == null)
	        	    {
						_Deleted_W = TearOff.Deleted;
					}
					return _Deleted_W;
				}
			}

			public AggregateParameter LastModifiedDate
		    {
				get
		        {
					if(_LastModifiedDate_W == null)
	        	    {
						_LastModifiedDate_W = TearOff.LastModifiedDate;
					}
					return _LastModifiedDate_W;
				}
			}

			public AggregateParameter LastModifiedByUser
		    {
				get
		        {
					if(_LastModifiedByUser_W == null)
	        	    {
						_LastModifiedByUser_W = TearOff.LastModifiedByUser;
					}
					return _LastModifiedByUser_W;
				}
			}

			public AggregateParameter BranchID
		    {
				get
		        {
					if(_BranchID_W == null)
	        	    {
						_BranchID_W = TearOff.BranchID;
					}
					return _BranchID_W;
				}
			}

			private AggregateParameter _ID_W = null;
			private AggregateParameter _InvoiceID_W = null;
			private AggregateParameter _PaymentMethodID_W = null;
			private AggregateParameter _PaidAmount_W = null;
			private AggregateParameter _PaidDate_W = null;
			private AggregateParameter _SaleUser_W = null;
			private AggregateParameter _Deleted_W = null;
			private AggregateParameter _LastModifiedDate_W = null;
			private AggregateParameter _LastModifiedByUser_W = null;
			private AggregateParameter _BranchID_W = null;

			public void AggregateClauseReset()
			{
				_ID_W = null;
				_InvoiceID_W = null;
				_PaymentMethodID_W = null;
				_PaidAmount_W = null;
				_PaidDate_W = null;
				_SaleUser_W = null;
				_Deleted_W = null;
				_LastModifiedDate_W = null;
				_LastModifiedByUser_W = null;
				_BranchID_W = null;

				this._entity.Query.FlushAggregateParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffAggregateParameter _tearOff;
			
		}
	
		public AggregateClause Aggregate
		{
			get
			{
				if(_aggregateClause == null)
				{
					_aggregateClause = new AggregateClause(this);
				}
		
				return _aggregateClause;
			}
		}
		
		private AggregateClause _aggregateClause = null;	
		#endregion
	
		protected override IDbCommand GetInsertCommand() 
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_InvoicePaymentHistoriesInsert]";
	
			CreateParameters(cmd);
			
			SqlParameter p;
			p = cmd.Parameters[Parameters.ID.ParameterName];
			p.Direction = ParameterDirection.Output;
    
			return cmd;
		}
	
		protected override IDbCommand GetUpdateCommand()
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_InvoicePaymentHistoriesUpdate]";
	
			CreateParameters(cmd);
			      
			return cmd;
		}
	
		protected override IDbCommand GetDeleteCommand()
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_InvoicePaymentHistoriesDelete]";
	
			SqlParameter p;
			p = cmd.Parameters.Add(Parameters.ID);
			p.SourceColumn = ColumnNames.ID;
			p.SourceVersion = DataRowVersion.Current;

  
			return cmd;
		}
		
		private IDbCommand CreateParameters(SqlCommand cmd)
		{
			SqlParameter p;
		
			p = cmd.Parameters.Add(Parameters.ID);
			p.SourceColumn = ColumnNames.ID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.InvoiceID);
			p.SourceColumn = ColumnNames.InvoiceID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.PaymentMethodID);
			p.SourceColumn = ColumnNames.PaymentMethodID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.PaidAmount);
			p.SourceColumn = ColumnNames.PaidAmount;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.PaidDate);
			p.SourceColumn = ColumnNames.PaidDate;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.SaleUser);
			p.SourceColumn = ColumnNames.SaleUser;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Deleted);
			p.SourceColumn = ColumnNames.Deleted;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.LastModifiedDate);
			p.SourceColumn = ColumnNames.LastModifiedDate;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.LastModifiedByUser);
			p.SourceColumn = ColumnNames.LastModifiedByUser;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.BranchID);
			p.SourceColumn = ColumnNames.BranchID;
			p.SourceVersion = DataRowVersion.Current;


			return cmd;
		}
	}
}
